package com.serkol.driving.learning.handler;

import cn.hutool.core.collection.CollectionUtil;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class SelectBuilder implements Serializable {
    private static final long serialVersionUID = -1536422416594422874L;

    private List<String> parts;

    public SelectBuilder() {
        this.parts = new ArrayList<>();
    }

    public void toEmpty() {
        parts.clear();
    }

    /**
     * 置 null
     *
     * @since 3.3.1
     */
    public void toNull() {
        parts = null;
    }

    public String getStringValue(){
        if (CollectionUtil.isNotEmpty(parts)) {
            return String.join(",", parts);
        }else {
            return null;
        }
    }

    public List<String> getParts() {
        return parts;
    }

    public void setParts(List<String> parts) {
        this.parts = parts;
    }
}
